package optional;

import lombok.Data;

import java.util.Optional;

@Data
public class User {
    private String name;
    private int age;
    private Car car;
    //获取汽车名
    public Optional<String> getPersonCarName(){
        return Optional.ofNullable(car.getCarName());
    }
}
